package com.woniuxy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: 马宇航
 * @Todo: 控制层，用来接收前端的请求
 * @DateTime: 22/03/30/0030 下午 2:52
 * @Component: 成都蜗牛学苑
 **/
@Controller
@RequestMapping("/rbacManager")
public class RbacManagerController {
    @RequestMapping(path="/findAll")
    public ModelAndView findAll(HttpServletRequest request){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("username",request.getParameter("user"));
        modelAndView.addObject("password","findAll");
        modelAndView.setViewName("/WEB-INF/jsp/success.jsp");
        return modelAndView;
    }
    @RequestMapping(value = {"/findOne","/one"},method = RequestMethod.GET)
    public ModelAndView findOne(HttpServletRequest request){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("username",request.getParameter("user"));
        modelAndView.addObject("password","findOne");
        modelAndView.setViewName("/WEB-INF/jsp/success.jsp");
        return modelAndView;
    }
    // /*/findOne表示，findOne前面只能有一个层级，但是字符不限制 /laksjdflkajs/findOne
    // /**/one 表示，前面可以有多个层级，每个层级内部字符不限制 /askljdf/asdf/one
    @RequestMapping(value = {"/*/findOne","/**/one"},method = RequestMethod.GET)
    public ModelAndView findOne2(HttpServletRequest request){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("username",request.getParameter("/*/findOne"));
        modelAndView.addObject("password","/**/one");
        modelAndView.setViewName("/WEB-INF/jsp/success.jsp");
        return modelAndView;
    }
}
